package leetcode.day_2021_03_8_2021_03_14;

import java.util.Arrays;
import java.util.Comparator;

/**
 * 252. 会议室
 */
public class LeetCode0252 {
    public static boolean canAttendMeetings(int[][] intervals) {
        Arrays.sort(intervals, Comparator.comparingInt(arr -> arr[0]));
        for (int i=1; i<intervals.length; i++) {
            if (intervals[i-1][1] > intervals[i][0])
                return false;
        }
        return true;
    }

    public static void main(String[] args) {
        int[][] arr = {{1,2}, {2,6}, {8,10}, {15,18}};
        System.out.println(canAttendMeetings(arr));
    }
}
